<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	request.setCharacterEncoding("UTF-8");
	String htmlData = request.getParameter("content1") != null ? request.getParameter("content1") : "";
%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="<%=path%>/My97DatePicker/WdatePicker.js"></script>
<link rel="stylesheet" type="text/css" href="<%=path%>/CSS/backLayout.css">
<style type="text/css">
input[type=checkbox]{padding:0px; margin:0px; text-align:right;width: 15px}
.div_input {
	width: 500px;
	height: 40px;
}
</style>
</head>
<body style="background: #f5f5f5">
<div class="main">
	<div class="weizhi">
        <c:if test="${empty fid}">
		学员基础资料>>班级>>新增
	</c:if>
	<c:if test="${not empty fid}">
		学员基础资料>>班级>>修改
	</c:if>
	</div>
	<div class="div_body" style="box-shadow: 0 0 5px #cccccc;">
		<div class="div_form">
            <form action="<%=path%>/DrivingSys/modifyOrAddClazz" class="form" method="post"
                  onsubmit=" return submit2();">
			<c:if test="${empty fid}">
				<div class="jczl">
						<div class="div_input">
							<span class="gn_name">驾校&nbsp;:&nbsp;</span>
							<input  type="text" name="name"  value="${department.fnameL2}" readonly="readonly" style="color: gray;"/>
						</div>
						<div class="div_input">
							<span class="gn_name">编码&nbsp;:&nbsp;</span>
                            <input type="text" name="fnumber" value="${fnumber}" readonly="readonly"
                                   style="color: gray;">
						</div>
						<div class="div_input">
							<span class="gn_name">班级名称&nbsp;:&nbsp;</span>
							<input type="text" name="fnameL2" id="fnameL2">
                            <span class="required">必填</span>
						</div>
						<div class="div_input">
							<span class="gn_name">班级简称&nbsp;:&nbsp;</span>
                            <input type="text" name="fsimplename">
						</div>
						<div class="div_input">
							<span class="gn_name">适用车辆&nbsp;:&nbsp;</span>
                            <select name="cfsycl" style="width: 234px;height: 31px">
								<c:forEach items="${carTypes}" var="s">
									<option value="${s}">${s}</option>
								</c:forEach>
							</select>
						</div>
                    <div class="div_input" style="width: 600px">
							<span class="gn_name">金额&nbsp;:&nbsp;</span>
							<input type="text" name="cfprice" id="cfprice">
                        <span class="required">必填</span>
							<span style="font-size: 14px;color: red;display: none" class="haoyou">请输入数字</span>
						</div>
						<div style="height: 60px;width: 500px">
							<div style="width: 200px;height: 60px;float: left;">
                                <span class="gn_name">是否包考试费&nbsp;:&nbsp;</span>
                                <input type="checkbox" name="cfksf2" id="cfksf2">
                                <input type="hidden" name="cfksf">
							</div>
							<div style="width: 200px;height: 60px;float: left;">
                                <span class="gn_name">是否包练车&nbsp;:&nbsp;</span>
                                <input type="checkbox" name="cflc2" id="cflc2">
                                <input type="hidden" name="cflc">
							</div>
						</div>
						<div style="height: 60px;width: 500px">
							<div style="width: 200px;height: 60px;float: left;">
                                <span class="gn_name">VIP&nbsp;:&nbsp;</span>
                                <input type="checkbox" name="cfvip2" id="cfvip2">
                                <input type="hidden" name="cfvip">
							</div>
							<div style="width: 200px;height: 60px;float: left;">
                                <span class="gn_name">特训班&nbsp;:&nbsp;</span>
                                <input type="checkbox" name="cftx2" id="cftx2">
                                <input type="hidden" name="cftx">
							</div>
						</div>
						<div style="height: 60px;width: 500px">
							<div style="width: 200px;height: 60px;float: left;">
                                <span class="gn_name">计时班&nbsp;:&nbsp;</span>
                                <input type="checkbox" name="cftime2" id="cftime2">
                                <input type="hidden" name="cftime">
                            </div>
						</div>
						<div class="div_input">
							<span class="gn_name">备注&nbsp;:&nbsp;</span>
                            <input type="text" name="fdescriptionL2">
						</div>
						<div class="div_input">
							<span class="gn_name">状态&nbsp;:&nbsp;</span>
                            <select name="cfstate" style="width: 234px;height: 31px">
								<option value="1">启用</option>
								<option value="2">禁用</option>
							</select>
						</div>
					</div>
				</c:if>

				<c:if test="${not empty fid}">
				<div class="jczl">
						<div class="div_input">
							<span class="gn_name">驾校&nbsp;:&nbsp;</span>
							<input  type="text" name="name"  value="${department.fnameL2}" readonly="readonly" style="color: gray;"/>
						</div>
						<input type="hidden" name="fid" value="${clazz.fid}" id="fid">
						<div class="div_input">
							<span class="gn_name">编码&nbsp;:&nbsp;</span>
							<input type="text" name="fnumber" value="${clazz.fnumber}" readonly="readonly" style="color: gray;" id="fnumber">
						</div>
						<div class="div_input">
							<span class="gn_name">班级名称&nbsp;:&nbsp;</span>
							<input type="text" name="fnameL2" id="fnameL2" value="${clazz.fnameL2}">
                            <span class="required">必填</span>
						</div>
						<div class="div_input">
							<span class="gn_name">班级简称&nbsp;:&nbsp;</span>
                            <input type="text" name="fsimplename" value="${clazz.fsimplename}">
						</div>
						<div class="div_input">
							<span class="gn_name">适用车辆&nbsp;:&nbsp;</span>
							<select name="cfsycl" style="width: 234px;height: 31px" id="cfsycl">
								<c:forEach items="${carTypes}" var="s">
									<c:choose>
										<c:when test="${clazz.cfsycl eq s}">
											<option value="${s}" selected="selected">${s}</option>
										</c:when>
										<c:otherwise>
											<option value="${s}">${s}</option>
										</c:otherwise>
									</c:choose>
								</c:forEach>
							</select>
						</div>
                    <div class="div_input" style="width: 600px">
							<span class="gn_name">金额&nbsp;:&nbsp;</span>
							<input type="text" name="cfprice" id="cfprice" value="${clazz.cfprice}">
                        <span class="required">必填</span>
							<span style="font-size: 14px;color: red;display: none" class="haoyou">请输入数字</span>
						</div>
						<div style="height: 60px;width: 500px">
							<div style="width: 200px;height: 60px;float: left;">
								<span class="gn_name">是否包考试费&nbsp;:&nbsp;</span>
								<c:if test="${clazz.cfksf == '0'}">
                                    <input type="checkbox" name="cfksf2" id="cfksf2">
								</c:if>
								<c:if test="${empty clazz.cfksf}">
                                    <input type="checkbox" name="cfksf2" id="cfksf2">
								</c:if>
								<c:if test="${clazz.cfksf == '1'}">
                                    <input type="checkbox" name="cfksf2" id="cfksf2" checked="checked">
								</c:if>
                                <input type="hidden" name="cfksf">
							</div>
							<div style="width: 200px;height: 60px;float: left;">
                                <span class="gn_name">是否包练车&nbsp;:&nbsp;</span>
								<c:if test="${clazz.cflc == '0'}">
                                    <input type="checkbox" name="cflc2" id="cflc2">
								</c:if>
								<c:if test="${empty clazz.cflc}">
                                    <input type="checkbox" name="cflc2" id="cflc2">
								</c:if>
								<c:if test="${clazz.cflc == '1'}">
                                    <input type="checkbox" name="cflc2" id="cflc2" checked="checked">
								</c:if>
                                <input type="hidden" name="cflc">
							</div>
						</div>
						<div style="height: 60px;width: 500px">
							<div style="width: 200px;height: 60px;float: left;">
                                <span class="gn_name">VIP&nbsp;:&nbsp;</span>
								<c:if test="${clazz.cfvip == '0'}">
                                    <input type="checkbox" name="cfvip2" id="cfvip2">
								</c:if>
								<c:if test="${empty clazz.cfvip}">
                                    <input type="checkbox" name="cfvip2" id="cfvip2">
								</c:if>
								<c:if test="${clazz.cfvip == '1'}">
                                    <input type="checkbox" name="cfvip2" id="cfvip2" checked="checked">
								</c:if>
                                <input type="hidden" name="cfvip">
							</div>
							<div style="width: 200px;height: 60px;float: left;">
                                <span class="gn_name">特训班&nbsp;:&nbsp;</span>
								<c:if test="${clazz.cftx == '0'}">
                                    <input type="checkbox" name="cftx2" id="cftx2">
								</c:if>
								<c:if test="${empty clazz.cftx}">
                                    <input type="checkbox" name="cftx2" id="cftx2">
								</c:if>
								<c:if test="${clazz.cftx == '1'}">
                                    <input type="checkbox" name="cftx2" id="cftx2" checked="checked">
								</c:if>
                                <input type="hidden" name="cftx">
							</div>
						</div>

						<div style="height: 60px;width: 500px">
							<div style="width: 200px;height: 60px;float: left;">
                                <span class="gn_name">计时班&nbsp;:&nbsp;</span>
								<c:if test="${clazz.cftime == '0'}">
                                    <input type="checkbox" name="cftime2" id="cftime2">
								</c:if>
								<c:if test="${empty clazz.cftime}">
                                    <input type="checkbox" name="cftime2" id="cftime2">
								</c:if>
								<c:if test="${clazz.cftime == '1'}">
                                    <input type="checkbox" name="cftime2" id="cftime2" checked="checked">
								</c:if>
                                <input type="hidden" name="cftime">
							</div>
						</div>

						<div class="div_input">
							<span class="gn_name">备注&nbsp;:&nbsp;</span>
							<input type="text" name="fdescriptionL2" id="fdescriptionL2" value="${clazz.fdescriptionL2}">
						</div>
						<div class="div_input">
							<span class="gn_name">状态&nbsp;:&nbsp;</span>
							<select name="cfstate" style="width: 234px;height: 31px" id="cfstate">
							<c:if test="${clazz.cfstate == '1'}">
								<option value="1">启用</option>
								<option value="2">禁用</option>
							</c:if>
							<c:if test="${clazz.cfstate == '2'}">
								<option value="2">禁用</option>
								<option value="1">启用</option>
							</c:if>
							</select>
						</div>
					</div>
				</c:if>
				<c:if test="${empty clazz}">
					<div class="div_tj" style="margin-left: 140px">
						<div>
                            <input type="submit" class="input_submit bc" value="" style="margin-right: 30px;">
						</div>
						<div>
                            <input type="button" class="input_back fh" value="" onclick="back()"/>
						</div>
					</div>
				</c:if>
				<c:if test="${not empty clazz}">
					<div class="div_tj" style="margin-left: 140px">
						<div>
                            <input type="submit" class="input_submit bc" value="" style="margin-right: 30px;"/>
						</div>
						<div>
                            <input type="button" class="input_back fh" value="" onclick="back()"/>
						</div>
					</div>
				</c:if>
			</form>
		</div>
	</div>
</div>
</body>
<script type="text/javascript" src="<%=path%>/JQuery/jquery-1.8.2.js"></script>
<%@ include file="/WEB-INF/JSP/ajax.jsp"%>
<script type="text/javascript">


    $(document).ready(function(){
	var type = "${type}"
	if(type == null || type == ''){

    }else{
        editAlert()
	}
})

    $("#cfprice").blur(function(){
		//只能输入数字和小数点
        var re = /^\d+(?=\.{0,1}\d+$|$)/
		//理论油耗的值
		var jine = $(this).val();
		//判断只能输入数字和小数点
		if(jine == ""){
			$(".haoyou").css("display","none");
		}else if(!re.test(jine)){
			$(".haoyou").css("display","inline");
			$(this).val("")
		}else{
			$(".haoyou").css("display","none");
		}
	})

    //验证
    function submit2() {
        var fnameL2 = $("#fnameL2").val();
        var cfprice = $("#cfprice").val();
        if ($('#cfksf2').is(':checked')) {
            $('#cfksf2').next().val("1")
        } else {
            $('#cfksf2').next().val("0")
        }
        if ($('#cflc2').is(':checked')) {
            $('#cflc2').next().val("1")
        } else {
            $('#cflc2').next().val("0")
        }
        if ($('#cfvip2').is(':checked')) {
            $('#cfvip2').next().val("1")
        } else {
            $('#cfvip2').next().val("0")
        }
        if ($('#cftx2').is(':checked')) {
            $('#cftx2').next().val("1")
        } else {
            $('#cftx2').next().val("0")
        }
        if ($('#cftime2').is(':checked')) {
            $('#cftime2').next().val("1")
        } else {
            $('#cftime2').next().val("0")
        }
        if (fnameL2 == null || fnameL2 == '') {
            alert("班级名称不能为空")
            return false
        }
        if (cfprice == null || cfprice == '') {
            alert("班级金额不能为空")
            return false
        }
        //防止重复提交
        $(this).attr("disabled", "disabled")
    }

	function back(){
        parent.closeSelectCard()

//        location = '<%=path%>/DrivingSys/queryClazz/look.action';
	}
</script>


</html>